<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.button.look"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.group-info {
            margin-top: 10px !important;
            margin-bottom: 0px !important;
        }
        input.innerInput {
            width: 98%;
        }
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.button.look"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.jieSuan.zhiFuDanGuanLi"/></a></li>
			<li class="active"><a href="#"><spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.button.look"/></a></li>
        </ol>
     </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                	
                	<div class="form-group form-group-xs">
                        <spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.listForm.mingCheng"/><spring:message code="message.yanZheng.maoHao"/> <input class="form-control" type="text" id="paymentBillName"  name="paymentBillName" placeholder="<spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.listForm.mingCheng"/>"/>
                   </div>
                	
                	<div class="form-group form-group-xs">
			             <spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.maoHao"/> <input class="form-control" type="text" id="paymentBillCode"  name="paymentBillCode" placeholder="<spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.yanZheng.bianMa"/>"/>
			       </div>
			       
			         <div class="form-group form-group-xs">
		                  <spring:message code="message.jieSuan.zhiFuDate"/><spring:message code="message.yanZheng.maoHao"/> 
		                 <input class="form-control" type="text" id="payTime"  name="payTime" data-date-fmt="yyyy-MM-dd" placeholder="yyyy-MM-dd"  onFocus="var submitEndDatetime=$dp.$('submitEndDatetime');WdatePicker({maxDate:'#F{$dp.$D(\'submitEndDatetime\')}'})" />
		                  - 
		                 <input class="form-control" type="text" id="submitEndDatetime"  name="submitEndDatetime"  data-date-fmt="yyyy-MM-dd" placeholder="yyyy-MM-dd"  onFocus="WdatePicker({minDate:'#F{$dp.$D(\'payTime\')}'})" />
			       </div>
                   <button id="selectWSJ"  type="button" onclick="gridSerch();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                    
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
   </section>
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
   <script type="text/javascript">
   
   //加载页面光标在名字框内，位于第一个
   $("#paymentBillName").focus();
   
 //绑定回车    id="selectWSJ"  
   $('#paymentBillName,#paymentBillCode,#payTime,#submitEndDatetime').bind('keydown', function(event) {
       if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
           $('#selectWSJ').click();
       }
   }); 
   
		$(function() {
				$("#gridlist").jqGrid({   
						url : "${ctx}/settlementPs/getSettlementPsList.html",
						mtype : "POST",
						datatype : "json",
						autowidth : true,
						shrinkToFit:true,
						height : 350,
						colNames : [ 
						             '<spring:message code="message.jieSuan.zhiFuDan"/>id',
						             '<spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.yanZheng.bianMa"/>',
						             '<spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.listForm.mingCheng"/>',
						             '<spring:message code="message.listForm.yiLiaoJiGou"/><spring:message code="message.jieSuan.shuMu"/>',
						             '<spring:message code="message.listForm.yaoPin"/><spring:message code="message.listForm.TiaoMuShu"/>',
						             '<spring:message code="message.jieSuan.zongJinE"/>',
						             '<spring:message code="message.jieSuan.zhiFuTime"/>',
						             '<spring:message code="message.jieSuan.zhiFuPeople"/>'
						             ],
						colModel : [
									{ name : 'paymentBillId',hidden:true, width : 100,align : "center",sortable:false},
									{ name : 'paymentBillCode', width : 140,align : "center",sortable:false},
									{ name : 'paymentBillName', width : 160,align : "center",sortable:false},
									{ name : 'hospCount', width : 100,align : "center",sortable:false,
										formatter:function(cellvalue, options, row){
											var str = "";
											str += "<a href='${ctx}/settlementPs/toPsHospSettleList.html?paymentBillId="+row.paymentBillId+"&paymentBillCode="+row.paymentBillCode+"&summoney="+row.summoney+"'>"+row.hospCount+"</a>";
											return str;
										}  },
									{ name : 'drugCount', width : 100,align : "center",sortable:false,
										formatter:function(cellvalue, options, row){
											var str = "";
							              	str += "<a href='${ctx}/settlementPs/toPsDrugSettleListForPayment.html?paymentBillId="+row.paymentBillId+"&paymentBillCode="+row.paymentBillCode+"&summoney="+row.summoney+"'>"+row.drugCount+"</a>";
											return str;
										} 
											},
									{ name : 'summoney', width : 120,align : "right",sortable:false,
										formatter:function(cellvalue, options, row) {
					                 		return formatAmount(cellvalue, options, row);
					                 	}
									},
									{ name : 'payTime', width : 140,align : "center",sortable:false},									
                                    { name : 'payUser', width : 180,align : "center",sortable:false}
									
						],
						rowNum : 20,
						rowList : [ 10, 20, 50, 100],
						rownumbers : true,
						pager : "#gridpage",
						multiselect: false, 
						viewrecords : true,
						caption : "<spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.listForm.lieBiao"/>",
						//序号宽度自动变化
		                gridComplete:function(){
		                    //序号列宽度自适应（参数为jqgridID）
		                    autoRNWidth("gridlist");
		                    //数据只有一条时默认选中（参数为jqgridID）
		                    selectByOneData("gridlist");
		                },
						jsonReader : {
							repeatitems : false,
							id : "ids"
						}
					});
			$("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
			$(window).trigger("resize");
		});
		
		
		
		//查询
        function gridSerch() {
        	var paymentBillCode = $.trim($("#paymentBillCode").val());
        	var paymentBillName = $.trim($("#paymentBillName").val());
 		   var payTime = $.trim($("#payTime").val());
 		   var submitEndDatetime = $.trim($("#submitEndDatetime").val());
 		   
 		 var arr1 = payTime.split("-");  
 		 var date1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);  
 		 var arr2 = submitEndDatetime.split("-");  
 		 var date2 = new Date(arr2[0],parseInt(arr2[1])-1,arr2[2]);  
 		 if (date1>date2) {
 			 alert("<spring:message code="message.jieSuan.startTimeNotGTREndTime"/>");
 			 return;
 		 }
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{
 				   "paymentBillCode":paymentBillCode,
 				   "paymentBillName":paymentBillName,
 				   "payTime":payTime,
 				   "submitEndDatetime":submitEndDatetime
 			   },
 			   page:1
 		   }).trigger("reloadGrid"); //重新载入  
        }
	   /* function gridSerch() {
		   var hospCode = $.trim($("#hospCode").val());
		   var billSettleDatetime = $.trim($("#billSettleDatetime").val());
		   
		   $("#gridlist").jqGrid('setGridParam',{  
			   url:"${ctx}/settlementFirst/hospSettleList.html",
			   datatype:'json',
			   postData:{
				   "hospCode":hospCode,
				   "billSettleDatetime":billSettleDatetime,
			   },
			   page:1
		   }).trigger("reloadGrid"); 
	   } */
       
        function CurentTime(now)  
    	{       	         
    	    var year = now.getFullYear();   
    	    var month = now.getMonth() + 1; 
    	    var day = now.getDate();     
    	    var hh = now.getHours();       
    	    var mm = now.getMinutes(); 
    	    var ss=now.getSeconds(); 
    	    var clock = year + "-"; 
    	    if(month < 10) clock += "0";         
    	    clock += month + "-";  
    	    if(day < 10) clock += "0";   
    	    clock += day + " "; 		
    	    return(clock);   
    	}			   

	</script>
</body>
</html>